<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <style type="text/css">
   td {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
   }
   .one {
	   background-color: #666666;
	   text-align: right;
	   } 
   .two {
	   background-color: #999999;
	   text-align: left;
	   }
   .three {
	   background-color: #CCCCCC;
	   text-align: right;
	   }
  </style>
  
<title>Инфо и Статистика по узлу</title>

</head>

<body>
<table width="350" border="1" align="left" cellpadding="1" cellspacing="1">
<tr width="100%">
	<td colspan="7" align="center">		</td>
</tr>
<tr width="100%">
	<td colspan="7" class=one align="center"><a href="zbx-frontend.html" title="back" target="_self">Back</a></td>
</tr>
<tr><td class=two width=130><b> 	</b></td> <td class=three><b> 	</b></td> <td class=three><b> 	</b></td></tr>

<?php
include("inc.db.conf.php");

$hostid = $_GET['hostid'];

$query = "
SELECT	events.objectid, SUM(events.value)
FROM triggers triggers 
	INNER JOIN events 		events ON triggers.triggerid = events.objectid
	INNER JOIN functions 	functions ON triggers.triggerid = functions.triggerid
	INNER JOIN items 		items ON functions.itemid = items.itemid
	INNER JOIN hosts 		hosts ON items.hostid = hosts.hostid
WHERE
	hosts.hostid = '10552'
	AND triggers.description = 'down'";

$result=mysql_query($query, $link) or die(mysql_errno($link).mysql_error($link));

while($row = mysql_fetch_array( $result )) {
$objid=$row['objectid'];
$bad_eventsum=$row['SUM(events.value)'];
?>

<!-- Вывод -->

<tr class=one>
<td class=two width="100"><?php echo $objid ?></td>
<td class=three width="140"><? echo $bad_eventsum ?></td>
<td class=three width="140"><? echo $hostid ?></td>
</tr>

<!-- ВАЖНАЯ СКОБОЧКА ЗАКРЫВАЮЩАЯ ЦИКЛ! -->
<?php } ?>

</table>
</body>
</html>
